home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / srcuc.zip / ANSIDECL.H next >
C/C++ Source or Header  |  1992-02-29  |  3KB  |  101 lines

  1. /* Copyright (C) 1990 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 1, or (at your option)
  7. any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with the GNU C Library; see the file COPYING.  If not, write to
  16. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. /* ANSI and traditional C compatibility macros
  19.  
  20.    ANSI C is assumed if __STDC__ is #defined.
  21.  
  22.     Macros
  23.         PTR        - Generic pointer type
  24.         LONG_DOUBLE    - `long double' type
  25.         CONST        - `const' keyword
  26.         VOLATILE    - `volatile' keyword
  27.         SIGNED        - `signed' keyword
  28.         PTRCONST    - Generic const pointer (void *const)
  29.  
  30.     EXFUN(name, prototype)        - declare external function NAME
  31.                       with prototype PROTOTYPE
  32.     DEFUN(name, arglist, args)    - define function NAME with
  33.                       args ARGLIST of types in ARGS
  34.     DEFUN_VOID(name)        - define function NAME with no args
  35.     AND                - argument separator for ARGS
  36.     NOARGS                - null arglist
  37.     DOTS                - `...' in args
  38.  
  39.     For example:
  40.     extern int EXFUN(printf, (CONST char *format DOTS));
  41.     int DEFUN(fprintf, (stream, format),
  42.           FILE *stream AND CONST char *format DOTS) { ... }
  43.     void DEFUN_VOID(abort) { ... }
  44. */
  45.  
  46. #ifndef    _ANSIDECL_H
  47.  
  48. #define    _ANSIDECL_H    1
  49.  
  50.  
  51. /* Every source file includes this file,
  52.    so they will all get the switch for lint.  */
  53. /* LINTLIBRARY */
  54.  
  55.  
  56. #ifdef    __STDC__
  57.  
  58. #define    PTR        void *
  59. #define    PTRCONST    void *CONST
  60. #define    LONG_DOUBLE    long double
  61.  
  62. #define    AND        ,
  63. #define    NOARGS        void
  64. #define    VOLATILE    volatile
  65. #define    SIGNED        signed
  66. #define    DOTS        , ...
  67.  
  68. /* Some systems don't declare their libraries correctly, making CONST
  69.    impossible to have. */
  70. #ifdef NO_CONST
  71. #define CONST
  72. #else
  73. #define    CONST        const
  74. #endif
  75.  
  76. #define    EXFUN(name, proto)        name proto
  77. #define    DEFUN(name, arglist, args)    name(args)
  78. #define    DEFUN_VOID(name)        name(NOARGS)
  79.  
  80. #else    /* Not ANSI C.  */
  81.  
  82. #define    PTR        char *
  83. #define    PTRCONST    PTR
  84. #define    LONG_DOUBLE    double
  85.  
  86. #define    AND        ;
  87. #define    NOARGS
  88. #define    CONST
  89. #define    VOLATILE
  90. #define    SIGNED
  91. #define    DOTS
  92.  
  93. #define    EXFUN(name, proto)        name()
  94. #define    DEFUN(name, arglist, args)    name arglist args;
  95. #define    DEFUN_VOID(name)        name()
  96.  
  97. #endif    /* ANSI C.  */
  98.  
  99.  
  100. #endif    /* ansidecl.h    */
  101.